import request from '@/require/http.js';
import Vue from 'vue'
//登录
export function userLogin(params,code) {
	return request('api/front/wechat/authorize/program/login?code='+code, 'post', params);
}
//绑定手机
export function userPhone(params) {
	return request('api/front/wechat/register/binding/phone', 'post', params);
}

//用户信息
export function userInfo(params){
	return request('/api/front/user','get',params);
}
//修改用户信息
export function userEdit(params){
	return request('/api/front/user/edit','post',params);
}
//退出
export function userLogout(params){
	return request('/api/front/logout','get',params);
}
//设备租凭
export function deviceLease(params){
	return request('/api/front/device/lease','post',params);
}
//设备交押金
export function deviceDeposit(params){
	return request('/api/front/device/deposit','post',params);
}
//退押金
export function deviceDepositRefund(params){
	return request('/api/front/device/deposit/refund','post',params);
}
//物料列表
export function deviceMeterials(params){
	return request('/api/front/device/materials','post',params);
}
//套餐列表
export function devicePackages(params){
	return request('/api/front/device/packages','post',params);
}
//时间段
export function deviceTimes(params){
	return request('/api/front/device/device_times','post',params);
}
//开关锁通知
export function deviceRptstat(params){
	return request('/api/front/device/rptstat','post',params);
}
//租赁订单
export function deviceOrder(params){
	return request('/api/front/device/lease/order','get',params);
}
//租赁订单详情
export function deviceOrderInfo(params){
	return request('/api/front/device/lease/info','get',params);
}
//文章列表
export function articleList(cid,params){
	return request('/api/front/article/list/'+cid,'get',params);
}
//文章详情
export function articleInfo(params){
	return request('/api/front/article/info','get',params);
}
//反馈类型
export function feedbackType(params){
	return request('/api/front/device/feedback/type','get',params);
}
//反馈提交
export function feedbackSave(params){
	return request('/api/front/device/feedback/save','post',params);
}

//被子信息
export function quilt(params){
	return request('/api/front/device/quilt/list','get',params);
}
//提交被子订单
export function quiltOrder(params){
	return request('/api/front/device/quilt/lease','post',params);
}
//完成被子订单
export function quiltComplete(params){
	return request('/api/front/device/quilt/complete','post',params);
}
//异常信息
export function errorAdd(params){
	return request('/api/front/device/error/add','post',params);
}

//押金列表
export function depositList(params){
	return request('/api/front/device/deposit/list','post',params);
}

//管理租赁订单
export function adminList(params){
	return request('/api/front/device/lease/admin/list','get',params);
}
//管理租赁订单详情
export function adminInfo(params){
	return request('/api/front/device/lease/admin/info','get',params);
}
//管理员完成订单
export function adminComplete(params){
	return request('/api/front/device/lease/admin/complete','post',params);
}
//管理员全款退款
export function adminRefund(params){
	return request('/api/front/device/lease/admin/full/refund','post',params);
}
//管理员异常订单
export function adminAbnormal(params){
	return request('/api/front/device/lease/admin/abnormal','post',params);
}
//医院列表
export function hospitalLists(params){
	return request('/api/front/device/hospital','get',params);
}
//设备型号
export function modeList(params){
	return request('/api/front/device/mode','get',params);
}
//信息
export function getTx(params){
	return request('/api/front/device/code','get',params);
}

//商品分类
export function goodsCate(params){
	return request('/api/front/category','get',params);
}
//商品列表
export function goodsList(params){
	return request('/api/front/products','get',params);
}
//加入购物车
export function addCar(params){
	return request('/api/front/cart/save','post',params);
}
//商品详情
export function goodsDeatil(id){
	return request('/api/front/product/detail/'+id,'get',{});
}
//商品评论
export function goodsPl(id,params){
	return request('/api/front/reply/list/'+id,'get',params);
}
//商品收藏
export function goodsSc(params){
	return request('/api/front/collect/add','post',params);
}
//取消收藏
export function goodsScs(id){
	return request('/api/front/collect/cancel/'+id,'post',{});
}
//购物车数量
export function carNum(params){
	return request('/api/front/cart/count','get',params);
}
//购物车
export function carList(params){
	return request('/api/front/cart/list','get',params);
}
//购物车修改
export function carEdit(params){
	return request('/api/front/cart/num?id='+params.id+'&number='+params.number,'post',params);
}
//购物车删除
export function carDel(params){
	return request('/api/front/cart/delete?ids='+params.ids,'post',params);
}
//预下单
export function yOrder(params){
	return request('/api/front/order/pre/order','post',params);
}
//加载预下单
export function jyOrder(params){
	return request('/api/front/order/load/pre/'+params.preOrderNo,'get',{});
}
//收货地址
export function addressList(params){
	return request('/api/front/address/list','get',params);
}
//默认地址
export function addressDefault(params){
	return request('/api/front/address/default','get',params);
}
//删除地址
export function addressDel(params){
	return request('/api/front/address/del','post',params);
}
//保存地址
export function addressEdit(params){
	return request('/api/front/address/edit','post',params);
}
//地址详情
export function addressInfo(params){
	return request('/api/front/address/detail/'+params.id,'get',{});
}
//设置默认地址
export function addressSet(params){
	return request('/api/front/address/default/set','post',params);
}
//省市区
export function areas(params){
	return request('/api/front/city/list','get',params);
}
// 上传文件
export function uploadFile(url, formData,name = 'multipart' ) {
	return new Promise((resolve, reject) => {
		let a = uni.uploadFile({
			url: Vue.prototype.$imgUrl + '/api/front/user/upload/image', // 仅为示例，非真实的接口地址
			filePath: url,
			name,
			formData,
			header:{
				'Authori-zation':uni.getStorageSync('qlbToken')
			},
			success: (res) => {
				resolve(res.data)
			},
			complete:(com)=>{
				let coms=JSON.parse(com.data);
				if(coms.code!=200){
					uni.showToast({
						title:coms.message,
						icon:"none",
						duration:2000,
					})
					return;
				}
			}
		});
	})
}
























































